-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add network tab to node page with peer connectivity visualization #2826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: adameat <[email protected]>
|
@copilot no, you needed to add another tab on the node page. like storage, tablets, threads - there is should be a network tab, very similar to database's network tab. but with filter by current node. |
Co-authored-by: adameat <[email protected]>
You're absolutely right! I've corrected the implementation to add a proper "Network" tab to the node page (alongside Storage, Tablets, Threads tabs) instead of just adding network info to the node information panel. The new Network tab shows:
This matches the database network tab pattern but filtered specifically for the current node. Changes in commit d420599. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, 3 comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
src/containers/Node/Node.tsx, line 81-101 (link)logic: network tab appears even when peers handler is unavailable - availability checks must be consistently applied to prevent tabs from appearing when features are not available
add network tab to skippedTabs when peers handler unavailable:
Context Used: Rule from
dashboard- When adding config-related features, ensure availability checks usinguseConfigAvailable()are con... (source)
24 files reviewed, 3 comments
src/containers/Node/NodeNetwork/NodeNetworkControls/NodeNetworkControls.tsx
Outdated
Show resolved
Hide resolved
src/containers/Node/NodeNetwork/NodeNetworkControls/NodeNetworkControls.tsx
Outdated
Show resolved
Hide resolved
|
@greptile-review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
src/containers/Node/Node.tsx, line 81-101 (link)logic: network tab should be conditionally hidden based on
isPeersHandlerAvailablecapability check. The check is declared on line 219 but used only inrenderTabContent, not in tab list filtering logic.Add this after line 93:
if (!isPeersHandlerAvailable) { skippedTabs.push('network'); }
Also add
isPeersHandlerAvailableto useMemo dependencies on line 101.Context Used: Rule from
dashboard- When adding config-related features, ensure availability checks usinguseConfigAvailable()are con... (source)
24 files reviewed, 3 comments
src/containers/Node/NodeNetwork/NodeNetworkControls/NodeNetworkControls.tsx
Outdated
Show resolved
Hide resolved
src/containers/Node/NodeNetwork/NodeNetworkControls/NodeNetworkControls.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
-
src/containers/Node/Node.tsx, line 81-94 (link)logic: network tab should be hidden when
/viewer/peershandler is not available, per custom rule a628e697 about applying availability checks consistently across all pagesContext Used: Rule from
dashboard- When adding config-related features, ensure availability checks usinguseConfigAvailable()are con... (source)
24 files reviewed, 1 comment
| header: NODE_NETWORK_COLUMNS_TITLES.ConnectTime, | ||
| align: DataTable.LEFT, | ||
| width: 150, | ||
| resizeMinWidth: 120, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set it up so that the default width is enough to display without ellipsis.
| type NetworkWrapperProps = Pick< | ||
| NodesProps, | ||
| 'path' | 'scrollContainerRef' | 'database' | 'databaseFullPath' | ||
| 'path' | 'scrollContainerRef' | 'database' | 'databaseFullPath' | 'nodeId' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems no need to tune this component?
| return <Configs database={database} scrollContainerRef={parentContainer} />; | ||
| } | ||
|
|
||
| case 'network': { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if not isPeersHandlerAvailable, there shouldn't be such a tab at all. Also if network is in url, we should redirect user to default tab and change url as well.
src/containers/Nodes/NodesTable.tsx
Outdated
| database?: string; | ||
| databaseFullPath?: string; | ||
|
|
||
| nodeId?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for changes in this component?
| selectedColumnsKey: string; | ||
| groupByParams: NodesGroupByField[]; | ||
| onDataFetched?: (data: PaginatedTableData<PreparedStorageNode>) => void; | ||
| nodeId?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also no need?
src/containers/Nodes/getNodes.ts
Outdated
| peerRoleFilter, | ||
| filterGroup, | ||
| filterGroupBy, | ||
| nodeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need?
src/services/api/viewer.ts
Outdated
| {concurrentId, signal}: AxiosOptions = {}, | ||
| ) { | ||
| return this.get<TPeersResponse>( | ||
| this.getPath('/viewer/json/peers?enums=true'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add enums: true uniformly as query params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
17 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
18 files reviewed, no comments
Stand: https://nda.ya.ru/t/eafWrwwJ7NhqJT
This PR adds a Network tab to the individual node page, displaying connectivity data that helps users understand network topology and relationships between nodes.
Changes Made
New Network Tab
UI Components
NodeNetworkcomponent that follows the same pattern as the database network tabNodeNetworkcomponent from the database diagnostics for consistent visualizationTab Configuration
NODE_TABS_IDSandNODE_TABSconfigurationrenderTabContentswitch in Node.tsxInternationalization
Technical Implementation
The implementation leverages the existing network API (
networkApi.useGetNetworkInfoQuery) and filters the results to focus on the current node and its peers. The network tab uses the same visual components and interaction patterns as the database network tab, providing a consistent user experience.The network information is fetched only when a tenant name is available, and the component gracefully handles cases where no network data or peers are found.
Visual Impact
The network tab provides users with:
This enhancement improves the monitoring and debugging experience for YDB cluster administrators by making network relationships more visible and accessible at the individual node level.
Fixes #2428.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
CI Results
Test Status:⚠️ FLAKY
📊 Full Report
Test Changes Summary ⏭️2
⏭️ Skipped Tests (2)
Bundle Size: 🔺
Current: 66.06 MB | Main: 66.02 MB
Diff: +0.03 MB (0.05%)
ℹ️ CI Information
/viewer/peershandler is available)getNodePeersmethod in ViewerAPI that calls/viewer/json/peersendpoint with filtering, sorting, and pagination supportbytesToMBandbytesToSpeedfunctions with optional precision parameter for consistent formattingTechnical Highlights
The implementation follows existing patterns consistently - reuses column definitions from
nodesColumns, follows the same tab integration pattern as other node tabs (storage, tablets, threads), and uses proper capability checks to ensure backward compatibility with older YDB versions that don't support the peers endpoint.Confidence Score: 5/5
Important Files Changed
File Analysis
getNodePeersAPI method following existing patternsSequence Diagram
sequenceDiagram participant User participant NodePage as Node.tsx participant NodeNetwork as NodeNetwork.tsx participant NodeNetworkTable as NodeNetworkTable.tsx participant getNodePeers as getNodePeers.ts participant ViewerAPI as viewer.ts participant Backend as YDB Backend participant Mapper as nodeNetworkMapper.ts User->>NodePage: Navigate to Node page NodePage->>NodePage: Check capabilities (useViewerPeersHandlerAvailable) alt Peers handler available NodePage->>NodePage: Include network tab in nodeTabs else Not available NodePage->>NodePage: Skip network tab end User->>NodePage: Click Network tab NodePage->>NodeNetwork: Render NodeNetwork component NodeNetwork->>NodeNetwork: Setup columns with useMemo NodeNetwork->>NodeNetwork: Filter columns based on bridge mode NodeNetwork->>NodeNetworkTable: Render table with nodeId, searchValue, columns NodeNetworkTable->>NodeNetworkTable: Create filters with useMemo NodeNetworkTable->>getNodePeers: fetchData(params) getNodePeers->>getNodePeers: Extract nodeId, searchValue, sortParams getNodePeers->>getNodePeers: Map columnId to PeersSortValue getNodePeers->>ViewerAPI: getNodePeers({nodeId, filter, sort, limit, offset}) ViewerAPI->>Backend: GET /viewer/json/peers Backend-->>ViewerAPI: TPeersResponse ViewerAPI-->>getNodePeers: TPeersResponse loop For each peer getNodePeers->>Mapper: mapPeerToNodeNetworkRow(peer) Mapper->>Mapper: Calculate ClockSkewUs = (fSkewUs - rSkewUs) / 2 Mapper->>Mapper: Calculate PingTimeUs = (fPingUs + rPingUs) / 2 Mapper-->>getNodePeers: NodePeerRow end getNodePeers-->>NodeNetworkTable: {data, found, total} NodeNetworkTable->>NodeNetworkTable: Update table state NodeNetworkTable-->>NodeNetwork: Display peer data NodeNetwork-->>NodePage: Render complete NodePage-->>User: Show network peers table